var common = require('../../utils/util.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id: '',
    comment: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      id: options.id
    })
  },

  textareas: function (e) {
    this.setData({
      comment: e.detail.value
    })
  },
  addComment() {
    if(!this.data.comment) {
      wx.showToast({
        title: '评论不能为空',
        icon: "none",
      })
      return
    }
    wx.showLoading({
      title: "加载中",
      mask: true
    });
    common.getData_user(common.config.AddComment, {
      news_id: this.data.id,
      comment: this.data.comment
    }, "post", function () {
      wx.hideLoading()
      wx.navigateBack()
    });
  }

})